import React, { Component } from 'react'
import axios from "axios"
let obj1={
  Forsale:"代售",
  Sold:'已售',
  Soldout:'售出',
  newproduct:'新产品'}
export class Detils extends Component {
   constructor(props) {
     super(props)
   
     this.state = {
       obj:{}
     }
   }
   
  
  
  
  componentDidMount() { 
    axios.get("/datalist",{
      params:{
        id:this.props.match.params.id
      }
    }).then((res)=>{
      this.setState({
        obj:res.data
      })

    })
   }
    


  render() {
    // const {match}=this.props
    const {obj}=this.state
    return (
      <div>
        <p><img src={obj.img}/></p>
        <p>  {obj.title}</p>
        <p> {obj1[obj.tag]}</p>
      

      </div>
    )
  }
}

export default Detils